From 479bf0c0bec2e99442214facf0f414c2c737ac7b Mon Sep 17 00:00:00 2001
From: Yangbo Lu <yangbo.lu@nxp.com>
Date: Mon, 16 Oct 2017 11:57:36 +0800
Subject: [PATCH] armv8: ls1088ardb: add LEDE boot support in environment

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 include/configs/ls1088ardb.h | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
index 7bd152d..4cefa40 100644
--- a/include/configs/ls1088ardb.h
+++ b/include/configs/ls1088ardb.h
@@ -404,7 +404,20 @@
 		"env exists secureboot && mmc read $kernelheader_addr_r "		\
 		"$kernelhdr_addr_sd $kernelhdr_size_sd "		\
 		" && esbc_validate ${kernelheader_addr_r};"	\
-		"bootm $load_addr#$BOARD\0"
+		"bootm $load_addr#$BOARD\0"			\
+	"lede_setenv=setenv loadaddr 82000000 && " \
+		"setenv fdtaddr 8f000000 && " \
+		"setenv bootargs ubi.mtd=10 root=ubi0:rootfs rw " \
+		"rootfstype=ubifs noinitrd " \
+		"earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 " \
+		"mtdparts=20c0000.quadspi:1M(rcw),2M(u-boot),1M(u-boot-env)," \
+		"6M(reserved-1),3M(mc),1M(dpl),1M(dpc),1M(dtb)," \
+		"16M(kernel),32M(ubifs)\0" \
+	"lede_run=sf probe 0:0 && " \
+		"sf read $fdtaddr f00000 100000 && " \
+		"sf read $loadaddr 1000000 1000000 && " \
+		"bootm $loadaddr - $fdtaddr\0" \
+	"lede_boot=run lede_setenv;run lede_run\0"
 
 #undef CONFIG_BOOTCOMMAND
 #if defined(CONFIG_QSPI_BOOT)
@@ -429,6 +442,18 @@
 			"run distro_bootcmd;run sd_bootcmd;"		\
 			"env exists secureboot && esbc_halt;"
 #endif
+
+#undef CONFIG_BOOTCOMMAND
+#define CONFIG_BOOTCOMMAND                                      \
+		"sf probe 0:0;sf read 0x80000000 0xA00000 0x300000;"	\
+		"sf read 0x80300000 0xE00000 0x100000;"		\
+		"fsl_mc start mc 0x80000000 0x80300000;"	\
+		"sf read 0x80400000 0xd00000 0x100000;"	\
+		"fsl_mc apply dpl 0x80400000;"	\
+		"run lede_boot;"
+#undef CONFIG_BOOTDELAY
+#define CONFIG_BOOTDELAY		3
+
 /* MAC/PHY configuration */
 #ifdef CONFIG_FSL_MC_ENET
 #define CONFIG_PHYLIB_10G
-- 
2.7.4

